package shape3D;     

import javafx.application.Application;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.shape.*;
import javafx.scene.transform.Rotate;

// 圆柱
public class CylinderDemo extends Application { 
	private HBox root = new HBox();
	private Cylinder cylinder;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		for(int i=5; i>=1; i--) {
			cylinder = new Cylinder(50, 100);
			cylinder.setTranslateZ(i*100);
			cylinder.setRotationAxis(Rotate.Z_AXIS);		// 绕z轴旋转
			cylinder.setRotate(30);
			root.getChildren().addAll(cylinder);
		}
		root.getChildren().add(new Button("111"));
		Scene scene = new Scene(root, 700, 400, true);		// 开启3D效果
		scene.setCamera(new PerspectiveCamera());		// 设置相机
		stage.setScene(scene);
		stage.show();
	}
}





